home *** CD-ROM | disk | FTP | other *** search
/ FishMarket 1.0 / FishMarket v1.0.iso / fishies / 151-175 / disk_166 / stevie / source / dec.c < prev    next >
C/C++ Source or Header  |  1992-05-06  |  765b  |  32 lines

  1. /*
  2.  * STEVIE - Simply Try this Editor for VI Enthusiasts
  3.  *
  4.  * Code Contributions By : Tim Thompson           twitch!tjt
  5.  *                         Tony Andrews           onecom!wldrdg!tony 
  6.  *                         G. R. (Fred) Walter    watmath!watcgl!grwalter 
  7.  */
  8.  
  9. #include "stevie.h"
  10.  
  11. /*
  12.  * dec(p) 
  13.  *
  14.  * Decrement the line pointer 'p' crossing line boundaries as necessary. Return
  15.  * 1 when crossing a line, -1 when at start of file, 0 otherwise. 
  16.  */
  17. int
  18. dec(lp)
  19.     LPTR           *lp;
  20. {
  21.     if (lp->index > 0) {    /* still within line */
  22.     lp->index--;
  23.     return 0;
  24.     }
  25.     if (lp->linep->prev != NULL) {    /* there is a prior line */
  26.     lp->linep = lp->linep->prev;
  27.     lp->index = strlen(lp->linep->s);
  28.     return 1;
  29.     }
  30.     return -1;            /* at start of file */
  31. }
  32.